< previous page page_271 next page >

Page 271
Working with Dates
In Visual Basic 6.0, two controls that greatly simplify your ability to enter dates were added to the second Windows Common controls group. These controls are the MonthView control and the DTPicker control. The MonthView control, pictured in Figure 12.21, is a versatile calendar control that lets users select dates visually rather than enter dates with the keyboard.
0271-01.jpg
Figure 12.21
A MonthView control allows your users to select a date
value by looking at a calendar rather than having to type it.
Changing the Appearance of the MonthView
Figure 12.21 shows the MonthView control as it appears by default. You can use several additional properties to change the initial appearance and behavior of the control, however. Some of them are listed in Tables 12.2 and 12.3.
Table 12.2 Appearance Properties of the MonthView Control
NameDefault ValueDescription
ShowTodayTrueControls whether a line appears at the bottom of the calendar indicating the current date.
ShowWeekNumbersFalseControls whether a column displaying the week number appears to the left of each month.
ScrollRate1Controls how many months the calendar advances or moves back when users click the scroll buttons. Note that even if this property is set to a value higher than 1, users can still move through the months one at a time by clicking the trailing dates at the corners of the MonthView control.
DayBold ( )FalseControls whether the specified date is displayed in bold type. This property is useful if you want to indicate special days on the calendar, such as holidays. To use the property, you must specify a date, as in the following example:
MonthView1.DayBold(#7/4/1998#) = True

The MonthView control allows you to specify colors for each of its individual sections.

 
< previous page page_271 next page >